/**
 * 
 */
package datatypes;

import static org.junit.Assert.*;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import de.dhbw.horb.inf2013.vierFarbenProblem.model.datatypes.Vertex;

/**
 * The Class VertexTest.
 */
public class VertexTest {
	
	/** The v. */
	protected Vertex v;

	/**
	 * Inizialisat vertex.
	 */
	@Before
	public void inizialisatVertex(){
		this.v = new Vertex(1);
	}

	/**
	 * Test j unit.
	 */
	@Test
	public void testJUnit() {
		Assert.assertEquals(1, 1);
	}
	
	/**
	 * Test inizialisation.
	 */
	@Test
	public void testInizialisation() {
		Vertex v = new Vertex(2);
		
		Assert.assertEquals(1, 1);
	}
	
	/**
	 * Test id.
	 */
	@Test
	public void testId() {		
		Assert.assertEquals(1, v.getId());
	}
	
	/**
	 * Test get neighbors no.
	 */
	@Test
	public void testGetNeighborsNo() {	
		
		Integer[] idArray = new Integer[0];

		
		Assert.assertArrayEquals(idArray, v.getNeighbors());
	}
	
	/**
	 * Test get neighbors single.
	 */
	@Test
	public void testGetNeighborsSingle() {	
		
		v.addNeighbor(2);
		
		Integer[] idArray = new Integer[1];
		idArray[0] = 2;
		
		Assert.assertArrayEquals(idArray, v.getNeighbors());
	}
	
	/**
	 * Test get neighbors multi.
	 */
	@Test
	public void testGetNeighborsMulti() {	
		
		v.addNeighbor(2);
		v.addNeighbor(3);
		
		Integer[] idArray = new Integer[2];
		idArray[0] = 2;
		idArray[1] = 3;
		
		Assert.assertArrayEquals(idArray, v.getNeighbors());
	}
	
	/**
	 * Test is neighbor single.
	 */
	@Test
	public void testIsNeighborSingle(){
		v.addNeighbor(2);

		Assert.assertEquals(true, v.isNeighbor(2));
	}
	
	/**
	 * Test is neighbor multi.
	 */
	@Test
	public void testIsNeighborMulti(){
		v.addNeighbor(2);
		v.addNeighbor(3);
		
		Assert.assertEquals(true, v.isNeighbor(2));		
		Assert.assertEquals(true, v.isNeighbor(3));
	}
	
	/**
	 * Test is neighbor no.
	 */
	@Test
	public void testIsNeighborNo(){
		Assert.assertEquals(false, v.isNeighbor(2));
	}

}
